/**
 * 定义通用业务数据
 */

console.log('------------------------- 页面刷新, 会导致state数据被重置')

const state = {
    token: '',
    userInfo: {},
    userRole: []
}

const getters = {
    token(_state) {
        return _state.token
    },
    userInfo: _state => _state.userInfo,
    userRole: _state => _state.userRole
}

export default {
    namespaced: true,
    state,
    getters,
    mutations: {
        setToken(_state, _token) {
            _state.token = _token
        },
        setUserInfo(_state, _userInfo) {
            _state.userInfo = _userInfo
        },
        setUserRole(_state, _userRole) {
            _state.userRole = _userRole
        }
    }
}